/**
 * Created by mooshroom on 2014/11/30.
 */
var editor =function(){
    return{
        init:function(){
            editor.markdownConfig();//编译配置
        },
        markdownConfig:function(){
            marked.setOptions({
                renderer: new marked.Renderer(),
                gfm: true,
                tables: true,
                breaks: false,
                pedantic: false,
                sanitize: true,
                smartLists: true,
                smartypants: false
            });


            //触发事件
            $("#doc-main").keyup(function(){
                //var word = $("#doc-input").html().replace(/(<br>)|(<div>)|(<\/div>)/g,'\r\n').replace(/&nbsp;/g,' ');
                var word = $("#doc-main").val();

                //console.log(word);
                document.getElementById('doc-show').innerHTML = marked(word);
                document.getElementById('read-only').innerHTML = marked(word);
                document.getElementById('post').value=
                prettyPrint();
            });

        }

    }
}();